package com.yunpuvip.sachet.rest.common.util.wxtool;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
import com.github.binarywang.wxpay.config.WxPayConfig;
import com.github.binarywang.wxpay.service.WxPayService;
import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl;
import com.yunpuvip.sachet.biz.service.SysparamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import java.util.Map;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;

/**
 * @ auther wushaohong
 * @ date  2019/8/11
 **/
public class WxPayTool {


    public static  final WxPayService wxPayService = new WxPayServiceImpl();


    public  static WxPayService setWxpayConfig(WxPayConfig wxpayConfig){

        wxPayService.setConfig(wxpayConfig);
        return wxPayService ;
    }

    public  static WxPayService getWxPayServiceInstance( ){

        return wxPayService ;
    }


    public static  void  Sort(WxPayUnifiedOrderRequest req){

        SortedSet<String> set = new TreeSet<>();
        set.add(req.getAppid());
        set.add(req.getMchId());
        set.add(req.getSignType());
        set.add(req.getBody());
        set.add(req.getTradeType());
        set.add(req.getNotifyUrl());
        set.add(req.getOutTradeNo());
        set.add(req.getSpbillCreateIp());
        set.add(req.getOpenid());
        set.add(req.getNonceStr());
        System.err.println("sort:"+set);

    }

}
